'use strick';

const setItem = function(key, value){
	//console.log('AppStorage setItem');
	//console.log(value);
	localStorage.setItem(key, value);
}

const setItemJson = function(key, json){
	let jsonStr = JSON.stringify(json);

	setItem(key, jsonStr);
}

const getItem = function(key){
	return localStorage.getItem(key);
}

const getItemJson = function(key){
	var jsonStr = getItem(key);
	if (jsonStr) {
		return JSON.parse(jsonStr);
	}
}

const removeItem = function(key){
	localStorage.removeItem(key);
}

const clear = function(){
	localStorage.clear();
}

export default{
	setItem, setItemJson,
	getItem, getItemJson,
	removeItem, clear
}